package sy5_1;

import java.util.InputMismatchException;
import java.util.Scanner;

public class Demo2 {
    public static void main(String[] args) {
        try {
        Scanner input=new Scanner(System.in);
        System.out.println("input r:");
        circle circle=new circle();
        circle.r=input.nextDouble();
        System.out.println("area:"+ circle.getarea(circle.r));
        }catch (InputMismatchException e){
            System.out.println("请输入数字");
        }
    }
    static class circle{
        double r;
        double getarea(double r){
            return r * r * Math.PI;
        }
    }
}
